﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Patent.CN;
using DevExpress.XtraCharts;

public partial class China_Chart_ChineseTimeTrendChart : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // Prevent IE Cache
        Response.Expires = 0;
        if (!IsPostBack)
        {
            //string topicID = Session["topicID"].ToString();
            string topicID = Session["topicID"].ToString();
            ChinaAnalysis cnAnalysis = new ChinaAnalysis(Convert.ToInt32(topicID));
            if (cnAnalysis.IsChineseTopic())
            {
                DataTable dt = cnAnalysis.GetTrendTable();

                WebChartCN.Series.Clear();
               
                Series syxxSeries = new Series("实用新型", ViewType.Line);
                Series fmzlSeries = new Series("发明专利", ViewType.Line);
                Series wgsjSeries = new Series("外观设计", ViewType.Line);
                Series totalSeries = new Series("总计", ViewType.Line);

                WebChartCN.Series.Add(syxxSeries);
                WebChartCN.Series.Add(fmzlSeries);
                WebChartCN.Series.Add(wgsjSeries);
                WebChartCN.Series.Add(totalSeries);

                syxxSeries.ArgumentDataMember = "年份";
                syxxSeries.ValueDataMembers.AddRange(new string[] { "实用新型" });

                fmzlSeries.ArgumentDataMember = "年份";
                fmzlSeries.ValueDataMembers.AddRange(new string[] { "发明专利" });

                wgsjSeries.ArgumentDataMember = "年份";
                wgsjSeries.ValueDataMembers.AddRange(new string[] { "外观设计" });

                totalSeries.ArgumentDataMember = "年份";
                totalSeries.ValueDataMembers.AddRange(new string[] { "总计" });

                foreach (Series series in WebChartCN.Series)
                {
                    series.Label.Visible = false;
                    series.DataSource = dt;
                    series.ArgumentScaleType = ScaleType.Qualitative;
                    series.ValueScaleType = ScaleType.Numerical;
                }
            }
        }

    }
}
